﻿<Window x:Class="Lines3D.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
		xmlns:local="clr-namespace:Lines3D"
        Title="MainWindow" WindowState="Maximized"
		xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        mc:Ignorable="d" 
        d:DesignHeight="500" d:DesignWidth="500"
		>
	<TabControl Name="mainTabControl">
		<!--Section with LIC-->
		<TabItem Header="Section with LIC">
			<Grid>
				<d3:TrackballDecorator>
					<d3:Interactive3DDecorator>
						<Viewport3D IsHitTestVisible="False" IsEnabled="False">

							<Viewport3D.Camera>
								<PerspectiveCamera Position="0 0 6" UpDirection="0 1 0"
                                   LookDirection="0 0 -1" FieldOfView="45">
								</PerspectiveCamera>
							</Viewport3D.Camera>

							<d3:Axes Extent="6"/>
							<d3:BoundsMesh Bounds="0,0,0   1,1,1"/>

							<d3:Viewport2DBillboardXY x:Name="vpXY" Center="0.5, 0.5" Width="1" Height="1" ThirdCoordinate="0.01">
								<d3:Viewport2DBillboardXY.Visual>
									<d3:ChartPlotter Name="plotterXY" MainHorizontalAxis="{x:Null}" MainVerticalAxis="{x:Null}"
												 Width="500" Height="500" Visible="0,0,1,1">
										<d3:VectorFieldConvolutionChart DataSource="{Binding}"/>
									</d3:ChartPlotter>
								</d3:Viewport2DBillboardXY.Visual>
							</d3:Viewport2DBillboardXY>

							<d3:Viewport2DBillboardXZ x:Name="vpXZ" Center="0.5, 0.5" Width="1" Height="1" ThirdCoordinate="0.01">
								<d3:Viewport2DBillboardXZ.Visual>
									<d3:ChartPlotter Name="plotterXZ" MainHorizontalAxis="{x:Null}" MainVerticalAxis="{x:Null}"
												 Width="500" Height="500" Visible="0,0,1,1">
										<d3:VectorFieldConvolutionChart DataSource="{Binding}"/>
									</d3:ChartPlotter>
								</d3:Viewport2DBillboardXZ.Visual>
							</d3:Viewport2DBillboardXZ>

							<d3:Viewport2DBillboardYZ x:Name="vpYZ" Center="0.5, 0.5" Width="1" Height="1" ThirdCoordinate="0.01">
								<d3:Viewport2DBillboardYZ.Visual>
									<d3:ChartPlotter Name="plotterYZ" MainHorizontalAxis="{x:Null}" MainVerticalAxis="{x:Null}"
												 Width="500" Height="500" Visible="0,0,1,1">
										<d3:VectorFieldConvolutionChart DataSource="{Binding}"/>
									</d3:ChartPlotter>
								</d3:Viewport2DBillboardYZ.Visual>
							</d3:Viewport2DBillboardYZ>

							<!--lights-->
							<ModelVisual3D>
								<ModelVisual3D.Content>
									<Model3DGroup>
										<AmbientLight Color="#7F7F7F"/>
										<DirectionalLight Color="#FFFFFFFF" Direction="0,0,-1"/>
										<DirectionalLight Color="#FFFFFFFF" Direction="-1,0,0"/>
										<DirectionalLight Color="#FFFFFFFF" Direction="0,-1,0"/>
									</Model3DGroup>
								</ModelVisual3D.Content>
							</ModelVisual3D>

						</Viewport3D>
					</d3:Interactive3DDecorator>
				</d3:TrackballDecorator>

				<Canvas>
					<Canvas.Resources>
						<Style TargetType="{x:Type Slider}">
							<Setter Property="Minimum" Value="0.01"/>
							<Setter Property="Maximum" Value="99.9"/>
							<Setter Property="Width" Value="200"/>
							<Setter Property="AutoToolTipPlacement" Value="BottomRight"/>
						</Style>
					</Canvas.Resources>

					<StackPanel Orientation="Vertical" Canvas.Bottom="20" Canvas.Left="20">
						<StackPanel>
							<Label>X:</Label>
							<Slider Name="xSlider" ValueChanged="xSlider_ValueChanged"/>
						</StackPanel>
						<StackPanel>
							<Label>Y:</Label>
							<Slider Name="ySlider" ValueChanged="ySlider_ValueChanged"/>
						</StackPanel>
						<StackPanel>
							<Label>Z:</Label>
							<Slider Name="zSlider" ValueChanged="zSlider_ValueChanged"/>
						</StackPanel>
					</StackPanel>
				</Canvas>
			</Grid>
		</TabItem>

		<!--Section with potentials-->
		<TabItem Header="Section with potentials">
			<Grid>
				<Grid.ColumnDefinitions>
					<ColumnDefinition/>
					<ColumnDefinition/>
				</Grid.ColumnDefinitions>
				<Border BorderThickness="2" BorderBrush="Gray" Background="LightGray" Grid.Column="0">
					<d3:TrackballDecorator>
						<d3:Interactive3DDecorator>
							<Viewport3D IsHitTestVisible="False" IsEnabled="False" Name="viewport">
								<d3:Axes Extent="6"/>
								<!--<d3:StreamLineChart3D x:Name="chart" DataSource="{Binding}" Bounds="-1,-1,0 2,2,2">
							<d3:StreamLineChart3D.Pattern>
								<d3:BottomPattern3D/>
							</d3:StreamLineChart3D.Pattern>
						</d3:StreamLineChart3D>-->
								<d3:BoundsMesh Bounds="0,0,0   1,1,1"/>

								<d3:VectorChart3D x:Name="vectorChart3D"/>

								<d3:SectionChartXY x:Name="sectionChartZ" ThirdCoordinate="{Binding Path=SliderPercentage, ElementName=sectionZ}"
										   Center="0.5,0.5"/>
								<d3:SectionChartXZ x:Name="sectionChartY" ThirdCoordinate="{Binding Path=SliderPercentage, ElementName=sectionY}" 
										   Center="0.5,0.5"/>
								<d3:SectionChartYZ x:Name="sectionChartX" ThirdCoordinate="{Binding Path=SliderPercentage, ElementName=sectionX}" 
										   Center="0.5,0.5"/>

								<ModelVisual3D>
									<ModelVisual3D.Content>
										<Model3DGroup>
											<AmbientLight Color="#7F7F7F"/>
											<DirectionalLight Color="#FFFFFFFF" Direction="0,0,-1"/>
										</Model3DGroup>
									</ModelVisual3D.Content>
								</ModelVisual3D>

								<Viewport3D.Camera>
									<PerspectiveCamera Position="0 0 6" UpDirection="0 1 0"
										LookDirection="0 0 -1" FieldOfView="45"/>
								</Viewport3D.Camera>
							</Viewport3D>
						</d3:Interactive3DDecorator>
					</d3:TrackballDecorator>
				</Border>

				<Border BorderThickness="2" BorderBrush="Gray" Grid.Column="1">
					<TabControl Name="tabControl" >
						<TabItem Header="XY Section">
							<local:SectionControl Variable="Z" x:Name="zSection" Header="Z ratio:"
												  SliderValueChanged="zSection_SliderValueChanged"/>
						</TabItem>
						<TabItem Header="XZ Section">
							<local:SectionControl Variable="Y" x:Name="ySection" Header="Y ratio:"
												  SliderValueChanged="ySection_SliderValueChanged"/>
						</TabItem>
						<TabItem Header="YZ Section">
							<local:SectionControl Variable="Z" x:Name="xSection" Header="X ratio:"
												  SliderValueChanged="xSection_SliderValueChanged"/>
						</TabItem>
					</TabControl>
				</Border>
			</Grid>
		</TabItem>

		<!--IsoSurface-->
		<TabItem Header="IsoSurface">
			<d3:TrackballDecorator>
				<d3:Interactive3DDecorator>
					<Viewport3D IsHitTestVisible="False" IsEnabled="False">

						<Viewport3D.Camera>
							<PerspectiveCamera Position="0 0 6" UpDirection="0 1 0"
                                   LookDirection="0 0 -1" FieldOfView="45">
							</PerspectiveCamera>
						</Viewport3D.Camera>

						<d3:Axes Extent="6"/>
						<d3:IsoSurface x:Name="isoSurface"/>
					</Viewport3D>
				</d3:Interactive3DDecorator>
			</d3:TrackballDecorator>
		</TabItem>

		<!--ConvolutionStack-->
		<TabItem Header="Convolution stack">
			<Grid>
				<d3:TrackballDecorator>
					<d3:Interactive3DDecorator>
						<Viewport3D IsHitTestVisible="False" IsEnabled="False">

							<Viewport3D.Camera>
								<PerspectiveCamera Position="0 2 6" UpDirection="0 1 0"
                                   LookDirection="0 -0.333 -1" FieldOfView="45">
								</PerspectiveCamera>
							</Viewport3D.Camera>

							<d3:Axes Extent="6"/>
							<d3:ConvolutionStack x:Name="convolutionStack" SectionCount="100"/>

							<ModelVisual3D>
								<ModelVisual3D.Content>
									<Model3DGroup>
										<AmbientLight Color="#7F7F7F"/>
										<DirectionalLight Color="#FFFFFFFF" Direction="0,-1,0"/>
										<DirectionalLight Color="#FFFFFFFF" Direction="0,+1,0"/>
									</Model3DGroup>
								</ModelVisual3D.Content>
							</ModelVisual3D>

						</Viewport3D>
					</d3:Interactive3DDecorator>
				</d3:TrackballDecorator>
				
				<Canvas>
					<ProgressBar Name="progressBar" Minimum="0" Maximum="1"
								 Canvas.Bottom="20" Canvas.Left="20" Width="200" Height="15"/>
					<Slider Orientation="Vertical" Name="valueSlider" Minimum="0" Maximum="99.9" Value="99.9"
							ValueChanged="valueSlider_ValueChanged"
							AutoToolTipPlacement="TopLeft"
							Canvas.Left="20" Canvas.Top="20" Height="500"/>
				</Canvas>
			</Grid>
		</TabItem>

	</TabControl>
</Window>
